|
|
 |
|
|
|
|
wid + 1, 0, wid, hgt, _
wid - 1, 0, -wid, hgt, vbSrcCopy |
|
|
|
|
|
|
|
|
Example program Mirror demonstrates both of these methods for creating a mirror image. It creates a third image using the Point and PSet methods, as shown in Figure 1.12, updating the image as it progresses. You can see from the program that the PaintPicture version is much faster than the other methods. In general, using special-purpose routines such as PaintPicture is faster than building routines yourself using the Point and PSet methods. For example, it is much faster to draw a line using the Line method than to plot the points in the line one at a time using PSet. |
|
|
|
|
|
|
|
|
The two Point/PSet techniques used by program Mirror take similar amounts of time, although they raise an interesting user interface design issue. Users generally perceive an interface element as more responsive if it presents itself all at once rather than showing itself in pieces as it is built. That means the version that does not refresh to show its progress may be perceived as faster even if the two methods take about the same amount of time. |
|
|
|
|
|
|
|
|
On the other hand, if a picture takes more than a few seconds to draw, the user may become impatient or not realize that the program is working. In that case, it is better to provide some feedback by allowing the user to watch the picture under construction. |
|
|
|
|
|
|
|
|
The Print method displays text on a drawing object. Its syntax is quite simple: |
|
|
|
|
|
|
|
|
The output list is a series of data items to be printed. If you separate two items with a semicolon, the Print method displays the second immediately after the first. If you separate two items with a comma, the Print method displays the second at the picture's next print zone. Print zones start every 14 columns, where the width of a column is the average width of a character on the drawing object. |
|
|
|
|
|
|
|
|
Figure 1.12
Example program Mirror compares three
different methods for creating a mirror image. |
|
|
|
|
|